<html class="off">
<head>
<meta charset="utf-8">
<title>编辑管理员</title>
		<link rel="stylesheet" href="__PUBLIC__/kindeditor/themes/default/default.css" />
		<script src="__PUBLIC__/kindeditor/kindeditor.js"></script>
		<script src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
		<!--
		必须引入jquery,后面的循环和赋值需要用到
		1.循环上传按钮、
		2.每个上传按钮的点击事件
		建议点击按钮的class有upload_img
		注意：点击按钮之前要用一个input来存放文件的路径
			input之前需要一个img来显示图片
		-->
		<script src="__PUBLIC__/kindeditor/jquery.js"></script>
		<script>
			KindEditor.ready(function(K) {
				var editor = K.editor({
					allowFileManager : true
				});
				$(".upload_img").each(function(k,v){ //循环上传按钮、
					$(v).click(function(){ //每个上传按钮的点击事件
						editor.loadPlugin('image', function() {
							editor.plugin.imageDialog({
								imageUrl:$(v).prev().val(),
								clickFn : function(url, title, width, height, border, align) {
									$(v).prev().val(url); //为他之前的input赋值
									$(v).prev().prev().attr("src",url); //为他之前的之前的img赋值
									editor.hideDialog();
								}
							});
						});
					});
				})
			});
		</script>
</head>
<body scroll="no">
<div id="content">
	<div class="right_main">
		<div id="J_rframe" class="rframe_b">
			<div class="subnav"><h1 class="title_2 line_x">编辑管理员</h1></div>
			<form action="{:U('User/edit')}" method="post" onsubmit="return check_form();">
				<input type="hidden" name="id" value="{$data.id}"/>
				<div class="pad_lr_10">
					<div class="col_tab">
						<div class="J_panes">
							<div class="content_list pad_10" style="display: block;">
								<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
									<tbody>
										<tr>
											<th width="120">所属分类 :</th>
											<td>
												<select class="J_cate_select mr10" name="pwdid">
													<option value="0">本身作为一级分类</option>
													<foreach name="power_data" item="power">
													<option value="{$power.id}"
													<if condition="$data['pwdid'] eq $power['id']">selected</if>
													>{$power.title}</option>
													</foreach>
												</select>
											</td>
										</tr>
										<tr>
											<th width="120">所属校区 :</th>
											<td>
												<select class="J_cate_select mr10" name="xid">
													<option value="0">总部</option>
													<foreach name="campus" item="c">
													<option value="{$c.id}" <if condition="$data['xid'] eq $c['id']">selected</if>
													>{$c.name}</option>
													</foreach>
												</select>
											</td>
										</tr>
										<tr>
											<th>名称 :</th>
											<td>
												<input type="text" value="{$data.name}" name="name" id="name" class="input-text" size="60">
												<div id="J_titleTip" class="onShow">请填写管理员名称</div>
											</td>
										</tr>
										<tr>
											<th>密码 :</th>
											<td>
												<input type="text" name="pwd" id="pwd" class="input-text" size="60">
												<div id="J_titleTip" class="onShow">请填写密码</div>
											</td>
										</tr>
										<tr>
											<th>确认密码 :</th>
											<td>
												<input type="text" id="pwd2" class="input-text" size="60">
												<div id="J_titleTip" class="onShow">请再次填写密码</div>
											</td>
										</tr>
										<tr>
											<th width="120">是否在职 :</th>
											<td>
												<select class="J_cate_select mr10" name="quit_id">
													<option value="0" <if condition="$data.quit_id eq 0">selected="selected"</if>>离职</option>
													<option value="1" <if condition="$data.quit_id eq 1">selected="selected"</if>>在职</option>
												</select>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
						<div class="mt10">
							<input type="submit" value="编&nbsp;&nbsp;辑" class="btn btn_submit">
							<input type="button" onclick="window.history.back(-1);" value="返&nbsp;&nbsp;回" class="btn btn_submit">
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
<script src="__PUBLIC__/js/jquery.js"></script>
<script>
//js验证表单提交的方法
function check_form() {
	var xid = $('select[name="xid"]').val();
	var name = $('#name').val();
	var pwd = $('#pwd').val();
	var pwd2 = $('#pwd2').val();
	if($.trim(xid) == 0) {
		alert('请选择校区');
		return false;
	}
	if($.trim(name) == '') {
		alert('请填写名称');
		return false;
	}
	if($.trim(pwd) != $.trim(pwd2)) {
		alert('两次密码输入不一致');
		return false;
	}
}
</script>
</body>
</html>